# Fieldbus Access runtime

## Service management

Fieldbus Access runs as a service and the management is different depending on
the system it runs on.

### CC Linux 5

The runtime starts as a service and can be controlled by `systemctl`. Use either
`enable` or `disable` to control if Fieldbus Access should autostart or not:

``` console
sudo systemctl enable fieldbusaccess
sudo systemctl disable fieldbusaccess
```

The service may also be started or stopped while the system is running:

``` console
sudo systemctl start fieldbusaccess
sudo systemctl stop fieldbusaccess
```

Output from the service can be checked with `journalctl`:

``` console
sudo journalctl -fu fieldbusaccess
```

## Startup arguments

```console
/appfs/bin/fieldbusaccess --help
Usage: fieldbusaccess [OPTIONS] config
Transfer configured signals between CAN-bus and Application through Data Engine

Options:
  -h, --help          Displays help on commandline options.
  --version          Displays version information.
  --name <Name>       Instance name of FA to use [Default: FieldbusAccess]
  -d, --debug <level> Additional debug output. Select level: 1=Debug,
                      2=Warning, 3=Critical, 4=Fatal.
  --ip <ip-address>   IP Address to DE [Default: 127.0.0.1]

Arguments:
  config              Path and name of configuration file to use.
```

### -h, --help

Display the help information.

### --version

Display version information about Fieldbus Access.

### --name \<Name>

Instance name of Fieldbus Access. Default if none is selected, 'fieldbusAccess'

### -d, --debug \<level>

Activate additional printouts during execution. Number selects level to print to
file. On both devices and the VM, the debug log is
`/data/home/ccs/FieldbusAccess/logs/debug_log.txt`. Ensure the runtime user
has permission to create or write to this directory. Argument level and higher will be
added to the log. If you add `-d 2 (Warning)` as argument, Warnings, Critical
and Fatal errors will be added to the logfile.

Level | Error    | Description
------|----------|-------------------------------------------------------------------------------------------------
1     | Debug    | Information that is diagnostically helpful
2     | Warning  | Anything that can potentially cause runtime oddities but are automatically recovering
3     | Critical | Any error which is critical to the operation. These errors will usually force user  intervention
4     | Fatal    | Any error that is forcing a shutdown of the runtime

### --ip \<ip-address>

IP Address to connect to Data Engine. Default is 'localhost' 127.0.0.1.

### Compatibility with earlier releases

The CLI11 command-line parser used in 1.7.0.0 accepts `--ip` and
`--version`, but does not register the legacy forms `-ip` and `-v`.
Update startup scripts that use these forms. A configuration file is required
when starting the runtime; `--help` and `--version` can be used without one.

Log formatting has changed with the removal of Qt. Scripts that parse log
messages may need updating.

### config

Nonoptional argument. Configuration file (.json) created by LinX Manager
Fieldbus Access

## Example

```console
fieldbusaccess [options] configuration
/appfs/bin/fieldbusaccess --debug 2 /appfs/bin/FieldbusAccess_ConfigFile.json
Will add `Warning, Critical and Fatal` messages in /data/home/ccs/FieldbusAccess/logs/debug_log.txt
```
